* lisp/treesit.el (treesit-indent-region): Handle markers (bug#77077).
authorJuri Linkov <juri@linkov.net>
Sat, 22 Mar 2025 18:37:35 +0000 (20:37 +0200)
committerJuri Linkov <juri@linkov.net>
Sat, 22 Mar 2025 18:37:35 +0000 (20:37 +0200)
Ensure that markers are converted to integers for 'beg' and 'end'.

lisp/treesit.el

index 2aa49a596d8db709cff23f2969aa7ea3ee2aec2f..d40088178fc7d97e3426b22515e8e34c1f9dc1c1 100644 (file)
@@ -2010,6 +2010,8 @@ reparse after indenting every single line.")
 (defun treesit-indent-region (beg end)
   "Indent the region between BEG and END.
 Similar to `treesit-indent', but indent a region instead."
+  (when (markerp beg) (setq beg (marker-position beg)))
+  (when (markerp end) (setq end (marker-position end)))
   (treesit-update-ranges beg end)
   ;; We indent `treesit--indent-region-batch-size' lines at a time, to
   ;; reduce the number of times the parser needs to re-parse.  In each